*******************************
***** CBI and Banking Crises **
***** APSR Replication       **
***** Appendix  			 **
***** 10/3/2021              **   

use "Crises_CBI_RepData.dta", clear

***********************************************
*** Defining globals to be used in plotting ***
***********************************************

global dvt local dvtitle = e(depvar)
global plot marginsplot, yline(0,lcolor(red)) recast(scatter) ytitle(`dvtitle') addplot(hist EmpM if e(sample),color(cyan%13) yaxis(2) width(0.15) legend(off) ylabel(,noticks nolabel axis(2)) ytitle("", axis(2)))

global dv_U d.logunemp_ilo ld.logunemp_ilo
global dv_Cr d.logdomcredit ld.logdomcredit
global dv_St d.logstockvalue ld.logstockvalue

program define danmplot

syntax , cvar(varname)
local dvtitle = e(depvar)

quietly marginsplot, yline(0,lcolor(red)) recastci(rarea) graphregion(color(white)) plotopts(msymbol(o) lcolor(navy) ytitle(`dvtitle') msize(tiny) mcolor(navy)) ci1opts(fintensity(60) color(navy%60)) ///
xlabel(#20,angle(-45) grid glcolor(%10)) ///
addplot(hist `cvar' if e(sample), yaxis(2) legend(off) color(cyan%15) ylabel(,noticks nolabel axis(2)) ytitle("", axis(2)))

end

************************************************************************
***************************|| APPENDIX ||*******************************
************************************************************************

** BMA analysis in R Script
** Code for Appendix Table AT1, AT4, & AT5 in main replication file
** Code for AF3 & AF4 (IV with Driscoll-Kraay SE's') & Appendix Table's AT2 & AT3 in R Script

***** APPENDIX TABLE AT1.5, DK Standard Errors ********

global cbiXsm d.KOFEcGIdf l.KOFFiGIdj d.fiscal l.logcpi l.loggdppc l.EquityBankRatio d.range 
global cbiXbig d.KOFEcGIdf l.KOFFiGIdj d.fiscal l.loggdppc leftgov l.eldem l.EquityBankRatio l.logtotresgdp l.default l.logcpi d.range l.range peg CrBubble5dum l.logcpi_Reg l.logevol__Reg uscrisis t_lastBCsys
******************************

quietly {
xtscc $dv_U c.cbi##c.BCsys $cbiXsm  if nondict==1, fe
est sto at1m1

xtscc $dv_U c.cbi##c.BCsys $cbiXbig  if nondict==1, fe
est sto at1m2

xtscc $dv_Cr  c.cbi##c.BCsys $cbiXsm  if nondict==1, fe
est sto at1m3

xtscc $dv_Cr  c.cbi##c.BCsys $cbiXbig  if nondict==1, fe
est sto at1m4

xtscc $dv_St  c.cbi##c.BCsys $cbiXsm  if nondict==1, fe
est sto at1m5

xtscc $dv_St  c.cbi##c.BCsys $cbiXbig  if nondict==1, fe
est sto at1m6
}
** table AT1.5 **
esttab at1m* , compress se nogaps label b(3) scalar(N_g g_avg) title("Table AT1.5: CBI and Banking Crises") star(* 0.1 ** 0.05 *** 0.001) replace


********************************
******** IPTW ESTIMATION *******
********************************

global prX cbi loggdppc  eldem CreditBubble  d.KOFFiGIdf KOFFiGIdj  peg EquityBankRatio CAdef logcred2dep logcpi d.range l.range westRate d.log_IMFgdp 

probit begBC2  $prX   if nondict==1    , cl(ccode) nolog
predict PRbeg_BC2, pr
est sto pr1

probit begBC2 l.begBC2 $prX   if nondict==1    , cl(ccode) nolog
predict PRbeg_BC2_dyn, pr
est sto pr2

*** Appendix Table AT7 ***
esttab pr1 pr2 , compress se nogaps label b(3) scalar(N_g g_avg) title("Table AT7: Inverse Probability Estimation (IPTW)")  star(* 0.1 ** 0.05 *** 0.001) replace

****************************************************
**** Creating the inverse crisis probability ****
gen inv_BC2prob = 1- PRbeg_BC2 
gen inv_BC2prob_dyn = 1- PRbeg_BC2_dyn 

*** IPTW estimator ***
global ipX logcpi d.range l.range westRate eldem d.KOFFiGIdf KOFFiGIdj peg loggdppc year 

quietly {
areg d.logunemp_ilo ld.logunemp_ilo c.cbi##c.BCsys $ipX     if nondict==1 [aweight=inv_BC2prob], cl(ccode) a(ccode)
est sto  iptw1
areg d.logdomcredit ld.logdomcredit c.cbi##c.BCsys  $ipX    if nondict==1 [aweight=inv_BC2prob], cl(ccode) a(ccode)
est sto  iptw2
areg d.logstockvalue ld.logstockvalue c.cbi##c.BCsys  $ipX    if nondict==1 [aweight=inv_BC2prob], cl(ccode) a(ccode)
est sto  iptw3

areg d.logunemp_ilo ld.logunemp_ilo c.cbi##c.BCsys $ipX     if nondict==1 [aweight=inv_BC2prob_dyn], cl(ccode) a(ccode)
est sto  iptw4
quietly margins, dydx(BCsys) at(cbi=(0.1(0.05)0.9)) force
danmplot, cvar(cbi)
graph save "cbi1_iptw.gph", replace

areg d.logdomcredit ld.logdomcredit c.cbi##c.BCsys $ipX     if nondict==1 [aweight=inv_BC2prob_dyn], cl(ccode) a(ccode)
est sto  iptw5
quietly margins, dydx(BCsys) at(cbi=(0.1(0.05)0.9)) force
danmplot, cvar(cbi)
graph save "cbi2_iptw.gph", replace 

areg d.logstockvalue ld.logstockvalue c.cbi##c.BCsys  $ipX    if nondict==1 [aweight=inv_BC2prob_dyn], cl(ccode) a(ccode)
est sto  iptw6
quietly margins, dydx(BCsys) at(cbi=(0.1(0.05)0.9)) force
danmplot, cvar(cbi)
graph save "cbi3_iptw.gph", replace
}

*** APPENDIX TABLE AT6
esttab iptw* , compress se nogaps label b(3) scalar(N_g g_avg) title("Table AT6: Inverse Probability Estimation (IPTW)")  star(* 0.1 ** 0.05 *** 0.001) replace

** APPENDIX FIGURE AF5
graph combine "cbi1_iptw.gph" "cbi2_iptw.gph" "cbi3_iptw.gph", title("Figure AF5 Inverse Probability Models")


******** ******** **************** ******** ****************
********|| EMPLOYMENT MANDATE MODELS //  ||******** ******** 
********|| Excluding N. America + N. Europe + W. Europe ****
******** ******** **************** ******** ********  ******
*** FIGURE AF6
global empX d.KOFEcGIdf  d.fiscal l.logcpi l.loggdppc l.eldem  CrBubble5dum uscrisis year
********** *****

quietly {
xtreg $dv_U c.EmpM##c.BCsys##c.FCBI_dum $empX  if nondict==1 & NAM_NWeur==0, cl(ccode) fe
quietly margins, dydx(BCsys) at(EmpM=(1(1)6) FCBI_dum==1)  force
$dvt
$plot
graph save "A_EM1.gph", replace

xtreg $dv_Cr c.EmpM##c.BCsys##c.FCBI_dum $empX  if nondict==1 & NAM_NWeur==0, cl(ccode) fe
quietly margins, dydx(BCsys) at(EmpM=(1(1)6) FCBI_dum==1)  force
$dvt
$plot
graph save "A_EM2.gph", replace

xtreg $dv_St c.EmpM##c.BCsys##c.FCBI_dum $empX  if nondict==1 & NAM_NWeur==0, cl(ccode) fe
quietly margins, dydx(BCsys) at(EmpM=(1(1)6) FCBI_dum==1)  force
$dvt
$plot
graph save "A_EM3.gph", replace

}

**** Figure 3 ****
graph combine "A_EM1.gph" "A_EM2.gph" "A_EM3.gph", title("Figure AF6: Crisis Effect w/ Mandates") subtitle("Excl. N. America & North/Western Europe")

*********************************************
**| SEEMINGLY UNRELATED REGRESSION model |***
*********************************************
**** APPENDIX FIGURE AF7

global xlist leftgov eldem   logtotresgdp EquityBankRatio  default cc3  westRate  logcpi loggdppc uscrisis i.ccode

*** HRV weighting SUR! w/ cty FE***
sureg (d.logunemp_ilo ld.logunemp_ilo c.cbi##c.BCsys  $xlist ) (d.logdomcredit ld.logdomcredit c.cbi##c.BCsys  $xlist ) (d.logstockvalue ld.logstockvalue  c.cbi##c.BCsys  $xlist ) if nondict==1 

quietly margins, dydx(BCsys) at(cbi=(0.1(0.05)0.9)) force predict(equation(D_logunemp_ilo))
danmplot, cvar(cbi)
graph save "SUR_unemp.gph", replace
quietly margins, dydx(BCsys) at(cbi=(0.1(0.05)0.9)) force predict(equation(D_logdomcredit))
danmplot, cvar(cbi)
graph save "SUR_cred.gph", replace
quietly margins, dydx(BCsys) at(cbi=(0.1(0.05)0.9)) force predict(equation(D_logstockvalue))
danmplot, cvar(cbi)
graph save "SUR_stock.gph", replace

*** FIGURE AF7 ***
graph combine "SUR_unemp.gph" "SUR_cred.gph" "SUR_stock.gph", col(3) 


*********************************************
**********|| APP Table AT8 ||****************
*********************************************

****** SUBSET Models, controlling for SOE credit and decade dummies
* App Table AT8
global subX   preBC_KOFFiGIdj preBC_logcred2dep preBC_CAdef d.log_IMFgdp cbreform d.range peg d.fiscal l.(CrBubble5dum EquityBankRatio KOFEcGIdf FD default logcpi soe_cred )   i.dec
global cbvar l.cbi d.cbi
*** UNEMP ***
quietly {
xtreg d.logunemp_ilo  $cbvar     if nondict==1 & BCsys==1, cl(ccode)
est sto at8m1
xtreg d.logunemp_ilo  $cbvar  $subX   if nondict==1 & BCsys==1, cl(ccode)
est sto at8m11
*** CREDIT ***
xtreg d.logdomcredit  $cbvar    if nondict==1 & BCsys==1, cl(ccode)
est sto at8m2
xtreg d.logdomcredit  $cbvar $subX    if nondict==1 & BCsys==1, cl(ccode)
est sto at8m22
*** STOCKS ***
xtreg d.logstockvalue  $cbvar    if nondict==1 & BCsys==1, cl(ccode)
est sto at8m3
xtreg d.logstockvalue  $cbvar  $subX  if nondict==1 & BCsys==1, cl(ccode)
est sto at8m33
*quietly margins, at(l.cbi=(0.1(0.05)0.9)) force
*marginsplot, yline(0,lcolor(red)) recastci(rarea) addplot(hist cbi if e(sample), yaxis(2) width(0.02) )
}
**** APPENDIX TABLE AT8
esttab at8m1 at8m11 at8m2 at8m22 at8m3 at8m33 , compress se nogaps label b(3) scalar(N_g g_avg) title("Table AT8: Crisis Years Models") drop() star(* 0.1 ** 0.05 *** 0.001) replace

*********************************************
**********|| APP Table AT9 ||****************
****** SUBSET CONTROLLING FOR pre-crisis level of unemployment, credit, and stock valuations

* App Table AT9
global subtrols   preBC_KOFFiGIdj preBC_logcred2dep preBC_CAdef d.log_IMFgdp cbreform d.range peg d.fiscal l.(CrBubble5dum EquityBankRatio KOFEcGIdf FD default logcpi  )  
global cbvar l.cbi d.cbi
*** UNEMP ***
quietly {
xtreg d.logunemp_ilo  $cbvar   preBC_logunemp_ilo  if nondict==1 & BCsys==1, cl(ccode)
est sto at9m1
xtreg d.logunemp_ilo  $cbvar  $subtrols preBC_logunemp_ilo  if nondict==1 & BCsys==1, cl(ccode)
est sto at9m11
*** CREDIT ***
xtreg d.logdomcredit  $cbvar   preBC_logdomcredit if nondict==1 & BCsys==1, cl(ccode)
est sto at9m2
xtreg d.logdomcredit  $cbvar $subtrols  preBC_logdomcredit  if nondict==1 & BCsys==1, cl(ccode)
est sto at9m22
*** STOCKS ***
xtreg d.logstockvalue  $cbvar  preBC_logstockvalue  if nondict==1 & BCsys==1, cl(ccode)
est sto at9m3
xtreg d.logstockvalue  $cbvar  $subtrols preBC_logstockvalue if nondict==1 & BCsys==1, cl(ccode)
est sto at9m33
*quietly margins, at(l.cbi=(0.1(0.05)0.9)) force
*marginsplot, yline(0,lcolor(red)) recastci(rarea) addplot(hist cbi if e(sample), yaxis(2) width(0.02) )
}
**** APPENDIX TABLE AT9
esttab at9m1 at9m11 at9m2 at9m22 at9m3 at9m33 , compress se nogaps label b(3) scalar(N_g g_avg) title("Table AT9: Crisis Years Models") drop() star(* 0.1 ** 0.05 *** 0.001) replace


************************************
********* CBI SUBSET MODELS random effects ********
************************************
*** Appendix Table AT10: Same as main table 2, but random effects

global subtrols   preBC_KOFFiGIdj preBC_logcred2dep preBC_CAdef d.log_IMFgdp cbreform d.range d.fiscal peg CrBubble5dum l.(EquityBankRatio KOFEcGIdf FD default logcpi  )  
global cbvar l.cbi d.cbi
*** UNEMP ***
quietly {
xtreg d.logunemp_ilo  $cbvar     if nondict==1 & BCsys==1, cl(ccode)
est sto at10m1
xtreg d.logunemp_ilo  $cbvar  $subtrols   if nondict==1 & BCsys==1, cl(ccode)
est sto at10m11
*** CREDIT ***
xtreg d.logdomcredit  $cbvar    if nondict==1 & BCsys==1, cl(ccode)
est sto at10m2
xtreg d.logdomcredit  $cbvar $subtrols    if nondict==1 & BCsys==1, cl(ccode)
est sto at10m22
*** STOCKS ***
xtreg d.logstockvalue  $cbvar    if nondict==1 & BCsys==1, cl(ccode)
est sto at10m3
xtreg d.logstockvalue  $cbvar  $subtrols  if nondict==1 & BCsys==1, cl(ccode)
est sto at10m33
*quietly margins, at(l.cbi=(0.1(0.05)0.9)) force
*marginsplot, yline(0,lcolor(red)) recastci(rarea) addplot(hist cbi if e(sample), yaxis(2) width(0.02) )
}
**** APPENDIX TABLE AT10_b
esttab at10m1 at10m11 at10m2 at10m22 at10m3 at10m33 , compress se nogaps label b(3) scalar(N_g g_avg) title("Table AT10: Crisis Years Models, Random Effects") drop() star(* 0.1 ** 0.05 *** 0.001) replace


*******************************************************************
********* SUBSET MODELS - using PRE-Crisis CBI measure ************
*******************************************************************
**|| Appendix Table AT10.B

global subtrols   preBC_KOFFiGIdj preBC_logcred2dep preBC_CAdef d.log_IMFgdp cbreform d.range peg d.fiscal CrBubble5dum l.(EquityBankRatio KOFEcGIdf FD default logcpi  )  
global cbvar preBC_cbi
*** UNEMP ***
quietly {

xtreg d.logunemp_ilo  $cbvar  $subtrols   if nondict==1 & BCsys==1, cl(ccode)
est sto at10bm11
*** CREDIT ***

xtreg d.logdomcredit  $cbvar $subtrols    if nondict==1 & BCsys==1, cl(ccode)
est sto at10bm22
*** STOCKS ***

xtreg d.logstockvalue  $cbvar  $subtrols  if nondict==1 & BCsys==1, cl(ccode)
est sto at10bm33
*quietly margins, at(l.cbi=(0.1(0.05)0.9)) force
*marginsplot, yline(0,lcolor(red)) recastci(rarea) addplot(hist cbi if e(sample), yaxis(2) width(0.02) )
}
esttab  at10bm11  at10bm22  at10bm33 , compress se nogaps label b(3) scalar(N_g g_avg) title("Table AT10.B: Crisis Years Models") drop() star(* 0.1 ** 0.05 *** 0.001) replace

********************************************************************
******** Appendix Table AT11 ***************************************
******** Does CBI predict differences in the fiscal response to crises? 

xtreg d.fiscal ld.fiscal cbi  if nondict==1 & BCsys==1, cl(ccode)
est sto r2
xtreg d.fiscal ld.fiscal cbi loggdppc logdebtgdp FD eldem xconst checks d.range peg CrBubble5dum logcpi KOFEcGIdf  KOFFiGIdj if nondict==1 & BCsys==1, cl(ccode)
est sto r22

esttab r2 r22 , compress se nogaps label b(3) scalar(N_g g_avg) title("AT11_CBI and Fiscal Responses") drop() star(* 0.1 ** 0.05 *** 0.001) replace

******** ********** ******** ****************** **********
*** Table AT12 : subset models, weighting by these transparency/data quality indicators
**************************************************

global r2trols   preBC_KOFFiGIdj preBC_logcred2dep preBC_CAdef d.log_IMFgdp cbreform d.range d.fiscal peg CrBubble5dum l.(EquityBankRatio KOFEcGIdf FD default logcpi soe_cred ) 
global zvar l.cbi d.cbi

** note: hrv2 is "hrv" re-scaled to not have negative values
/*
xtreg statcap loggdppc eldem hrv, cl(ccode) 
predict fitCap
*/
*** UNEMP ***
quietly {
reg d.logunemp_ilo  $zvar  $r2trols  if nondict==1 & BCsys==1 [aweight=hrv2], cl(ccode)
est sto r3tm1
reg d.logunemp_ilo  $zvar  $r2trols  if nondict==1 & BCsys==1 [aweight=fitCap], cl(ccode)
est sto r3tm11
reg d.logunemp_ilo  $zvar  $r2trols  if nondict==1 & BCsys==1 [aweight=eldem10], cl(ccode)
est sto r3tm111
*** CREDIT ***
reg d.logdomcredit  $zvar $r2trols   if nondict==1 & BCsys==1 [aweight=hrv2], cl(ccode) 
est sto r3tm2
reg d.logdomcredit  $zvar $r2trols   if nondict==1 & BCsys==1 [aweight=fitCap], cl(ccode) 
est sto r3tm22
reg d.logdomcredit  $zvar $r2trols   if nondict==1 & BCsys==1 [aweight=eldem10], cl(ccode) 
est sto r3tm222
*** STOCKS ***
reg d.logstockvalue  $zvar  $r2trols if nondict==1 & BCsys==1 [aweight=hrv2], cl(ccode) 
est sto r3tm3
reg d.logstockvalue  $zvar  $r2trols if nondict==1 & BCsys==1 [aweight=fitCap], cl(ccode) 
est sto r3tm33
reg d.logstockvalue  $zvar  $r2trols if nondict==1 & BCsys==1 [aweight=eldem10], cl(ccode) 
est sto r3tm333
}
esttab r3t* , compress se nogaps label b(3)  title("Table AT12: Models Weighted by Transparency, Statistical Capacity, and Democracy") star(* 0.1 ** 0.05 *** 0.001) replace

**************************************************
********** ALTERNATE INDICATOR - TBills *********
**************************************************
***|| Appendix Figure AF8
global cbiXsm d.KOFEcGIdf l.KOFFiGIdj d.fiscal l.logcpi l.loggdppc l.EquityBankRatio d.range 

xtreg  d.logTbills ld.logTbills  c.FCBI_dum##c.EmpM##c.BCsys $cbiXsm  year if nondict==1 , vce(cluster ccode) fe

quietly margins, dydx(BCsys) at(EmpM=(1(1)6) FCBI_dum=(1)) force
marginsplot, yline(0,lcolor(red)) title("Fig AF8: Marginal Effect of Bank Crisis on Short-term Treasury Bills") subtitle("Alternate Policy Indicator") recast(scatter) addplot(hist EmpM, yaxis(2) color(cyan%15))


*******************************************************
***** Controlling for CB financial supervision ********
*******************************************************
*** APP FIGURE AF9 & 10
global zX  c.CBISIndex##c.BCsys

quietly {
xtreg $dv_U c.cbi##c.BCsys $zX  if nondict==1, cl(ccode) fe
quietly margins, dydx(BCsys) at(cbi=(0.1(0.05)0.9)) force
danmplot, cvar(cbi)
graph save "v1.gph", replace

quietly margins, dydx(BCsys) at(CBISIndex=(1(1)6))  force
marginsplot, yline(0, lcolor(red))
graph save "v1_alt.gph", replace

xtreg $dv_Cr  c.cbi##c.BCsys $zX  if nondict==1, cl(ccode) fe
quietly margins, dydx(BCsys) at(cbi=(0.1(0.05)0.9)) force
danmplot, cvar(cbi)
graph save "v2.gph", replace

quietly margins, dydx(BCsys) at(CBISIndex=(1(1)6))  force
marginsplot, yline(0, lcolor(red))
graph save "v2_alt.gph", replace

xtreg $dv_St  c.cbi##c.BCsys $zX  if nondict==1, cl(ccode) fe
quietly margins, dydx(BCsys) at(cbi=(0.1(0.05)0.9)) force
danmplot, cvar(cbi)
graph save "v3.gph", replace

quietly margins, dydx(BCsys) at(CBISIndex=(1(1)6))  force
marginsplot, yline(0, lcolor(red))
graph save "v3_alt.gph", replace
}

graph combine "v1.gph" "v2.gph" "v3.gph", title("Figure AF9: Marginal Effect of Crisis across CBI") subtitle("Controlling for Crisis * CB Financial Supervision")

graph combine "v1_alt.gph" "v2_alt.gph" "v3_alt.gph", title("Figure AF10: Marginal Effect of Crisis across CB Financial Supervisison") subtitle("Controlling for Crisis * CBI")


*************************************
***** Excluding IMF PROGRAMS ********
*************************************

global cbiXsm d.KOFEcGIdf l.KOFFiGIdj d.fiscal l.logcpi l.loggdppc l.EquityBankRatio d.range 

******************************

quietly {
xtreg $dv_U c.cbi##c.BCsys $cbiXsm  if nondict==1 & imfdum==0, cl(ccode) fe

quietly margins, dydx(BCsys) at(cbi=(0.1(0.05)0.9)) force
danmplot, cvar(cbi)
graph save "w.gph", replace

xtreg $dv_Cr  c.cbi##c.BCsys $cbiXsm  if nondict==1 & imfdum==0, cl(ccode) fe

quietly margins, dydx(BCsys) at(cbi=(0.1(0.05)0.9)) force
danmplot, cvar(cbi)
graph save "w2.gph", replace

xtreg $dv_St  c.cbi##c.BCsys $cbiXsm  if nondict==1 & imfdum==0, cl(ccode) fe

quietly margins, dydx(BCsys) at(cbi=(0.1(0.05)0.9)) force
danmplot, cvar(cbi)
graph save "w3.gph", replace

}
*esttab t1m* using"Table1_CBI_FE.csv", compress se nogaps label b(3) scalar(N_g g_avg) title("Table 1: CBI and Banking Crises") drop() star(* 0.1 ** 0.05 *** 0.001) replace

graph combine "w.gph" "w2.gph" "w3.gph", title("Figure AF11: Marginal Effect of Banking Crises, Excluding IMF Program Years")


************************************************
************ ALTERNATE 2SLS INSTRUMENTS ********
************ GARRIGA & Rodriguez Approach ******
************************************************
global ivX d.KOFEcGIdf l.KOFFiGIdj d.fiscal l.logcpi l.loggdppc l.EquityBankRatio d.range logevol__Reg 

global cbiGIV1 cbi_RegAve
global cbiGIV2  eldem cbiREG_Dem

**Unemp**
quietly {
ivregress 2sls d.logunemp_ilo ld.logunemp_ilo  $ivX  i.ccode  (c.cbi##c.BCsys = cl.BCsys##cl.$cbiGIV1) if nondict==1 , vce(cluster ccode) 

quietly margins, dydx(BCsys) at(cbi=(0.1(0.05)0.9)) force
danmplot, cvar(cbi)
graph save "givc1.gph", replace
**credit**
ivregress 2sls d.logdomcredit ld.logdomcredit  $ivX  i.ccode (c.cbi##c.BCsys = cl.BCsys##cl.$cbiGIV1 )  if nondict==1 , vce(cluster ccode) 

quietly margins, dydx(BCsys) at(cbi=(0.1(0.05)0.9)) force
danmplot, cvar(cbi)
graph save "givc2.gph", replace
**stocks**
ivregress 2sls d.logstockvalue ld.logstockvalue  $ivX i.ccode (c.cbi##c.BCsys = cl.BCsys##cl.$cbiGIV1 )  if nondict==1, vce(cluster ccode) 

quietly margins, dydx(BCsys) at(cbi=(0.1(0.05)0.9)) force
danmplot, cvar(cbi)
graph save "givc3.gph", replace
}
graph combine "givc1.gph" "givc2.gph" "givc3.gph", title("Figure AF12: CBI IV Models, Garriga IV")

*******

**Unemp**
quietly {
ivregress 2sls d.logunemp_ilo ld.logunemp_ilo  $ivX  i.ccode  (c.cbi##c.BCsys = cl.BCsys##cl.$cbiGIV1 $cbiGIV2) if nondict==1 , vce(cluster ccode) 

quietly margins, dydx(BCsys) at(cbi=(0.1(0.05)0.9)) force
danmplot, cvar(cbi)
graph save "givc1.gph", replace
**credit**
ivregress 2sls d.logdomcredit ld.logdomcredit  $ivX  i.ccode (c.cbi##c.BCsys = cl.BCsys##cl.$cbiGIV1 $cbiGIV2)  if nondict==1 , vce(cluster ccode) 

quietly margins, dydx(BCsys) at(cbi=(0.1(0.05)0.9)) force
danmplot, cvar(cbi)
graph save "givc2.gph", replace
**stocks**
ivregress 2sls d.logstockvalue ld.logstockvalue  $ivX i.ccode (c.cbi##c.BCsys = cl.BCsys##cl.$cbiGIV1 $cbiGIV2)  if nondict==1, vce(cluster ccode) 

quietly margins, dydx(BCsys) at(cbi=(0.1(0.05)0.9)) force
danmplot, cvar(cbi)
graph save "givc3.gph", replace
}


****************************************************************************
******** ******** ******** ******** ******** ******** ******** ******** ******** ******** 

